<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../common/commonJS.jsp" %>
<%@ include file="../common/commonLabel.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>原材料信息新增</title>
<script type="text/javascript">
//保存并查询
function doIns(){
	if(check()){
		if(confirm("确认保存信息?")){
			document.all.operate.value = "insinfo";
			document.forms[0].submit();
		}
	}
}
 //限制添加快捷内容的字数  
var maxLength =30; 
function MaxInput(fo,len) {
	if(len!=""){
		maxLength=len;
	}
	if (fo.value.length > maxLength) {
		alert("输入内容过多！");
		fo.value = fo.value.substring(0, maxLength);
	}
}
function doback(){
	history.back();
	//document.all.operate.value = "";
	//document.forms[0].submit();
}
function doSta(obj){
	if(obj.value=="主料"){
		document.getElementById("selectsta").style.display="";
		document.getElementById("selectsta").disabled="";
		document.getElementById("textsta").style.display="none";
		document.getElementById("textsta").disabled="true";
	}else{
		document.getElementById("selectsta").style.display="none";
		document.getElementById("selectsta").disabled="true";
		document.getElementById("textsta").style.display="";
		document.getElementById("textsta").disabled="";
	}
}
</script>
</head>
<body>
<form action="<%=path %>/makings.action" method="post">
<table width="760" border="0" cellpadding="0" cellspacing="0" >
  <tr>
     <td>
     <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" class="MainBody">
      <tr>
        <td class="MainBody_title"><hello:forValue type="title" /></td>
      </tr>
        <tr>
          <td valign="top"><input name="operate" type="hidden" value=""/>
          <input name="mak.createuser" type="hidden" value="${sessionScope.admin_user.personid}"/>
          <div align="right" style="padding: 10 50 10 0;">
			<input type="button" class="btn" value="保 存" onclick="doIns()"/>&nbsp;&nbsp;
			<input type="reset" class="btn" value="重 置" />&nbsp;&nbsp;
			<input type="button" class="btn" value="返 回" onclick="doback()"/>&nbsp;&nbsp;</div>
          <table  border="0" cellpadding="0" cellspacing="0" class="MainBody_table">
                <tr>
                  <td colspan="4" class="bg_title">原 材 料 信 息</td>
                </tr>
                <tr>
                  <th width="15%" nowrap="nowrap">物料名称</th> 
                  <td width="35%"><input name="mak.goodsname" type="text" maxlength="50" check="checkBlank" title="物料名称" class="notnull"/></td>
                  <th width="15%" nowrap="nowrap">种类</th>
                  <td width="35%" ><select name="mak.goodstype" style="width: 98%" check="checkBlank" title="种类" ></select></td>
                </tr>
                
                <tr>
                  <th nowrap="nowrap">规格</th> 
                  <td id="sta"><select id="selectsta" name="mak.standard" style="width: 98%" check="checkBlank" title="规格" ></select>
                  <input id="textsta" name="mak.standard" type="text" value="${updinfo.standard}" maxlength="50" check="checkBlank" title="规格" class="notnull" style="display: none;" disabled="disabled"/></td>
                  <th nowrap="nowrap">品牌</th> 
                  <td ><input name="mak.brand" type="text" maxlength="50"/></td>
                </tr>
                
                <tr>
                  <th nowrap="nowrap">单位</th> 
                  <td ><select name="mak.unit" style="width: 98%" check="checkBlank" title="单位" ></select></td>
                  <th nowrap="nowrap">单价</th> 
                  <td ><input name="mak.price" type="text" maxlength="50" check="checkBlank,checkNaN" title="单价" class="notnull"/></td>
                </tr>
                
                <tr>
                  <th nowrap="nowrap">库房</th> 
                  <td><input name="mak.makingtype" type="radio" value="主料" <c:if test="${makingtype=='主料'}">checked</c:if> onclick="doSta(this)"/>主料&nbsp;&nbsp;&nbsp;&nbsp;
                  	  <input name="mak.makingtype" type="radio" value="辅料" <c:if test="${makingtype=='辅料'}">checked</c:if> onclick="doSta(this)"/>辅料</td>
                  <th nowrap="nowrap">预警库存</th> 
                  <td ><input name="mak.warnnum" type="text" value="0" maxlength="50" check="checkInt" title="预警库存" /></td>
                </tr>
                
                <tr>
                  <th align="center" nowrap="nowrap" >备注信息</th> 
                  <td colspan="3"><textarea name="mak.remark" style="width: 100%;" rows="6" onblur="MaxInput(this,100)"></textarea></td>
                </tr>
            </table>
		</td>
	</tr>
</table></td></tr></table>
<script type="text/javascript">
doSelectInfo(document.all["mak.unit"],'unit','');
doSelectInfo(document.all["mak.goodstype"],'goodstype','');
doSelectInfo(document.getElementById("selectsta"),'standard','');
</script>
</form>
</body>
</html>